import Vue from 'vue'
import Vuex from 'vuex'
import state from './state.js'
import actions from './actions.js'
import mutations from './mutations.js'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)


const store = new Vuex.Store({
	state,
	mutations,
	actions,
	plugins: [
		createPersistedState({
			storage: {
				getItem: (key) => uni.getStorageSync(key),
				setItem: (key, value) => uni.setStorageSync(key, value),
				removeItem: (key) => uni.removeStorageSync(key),
			},
		}),
	]
})

export default store
